﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace Card.BLL
{
    public class SiteManagerMangager
    {
        /// <summary>
        /// 数据访问类对象
        /// </summary>
        private static DAL.SITE_MANAGER dal = new DAL.SITE_MANAGER();

        #region  成员方法
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public static bool Exists(int userID, string areaCode, Security.Passport passport)
        {
            return dal.Exists(userID, areaCode, passport);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public static bool Add(Entity.SiteManager entity, Security.Passport passport)
        {
            return dal.Add(entity, passport);
        }

        /// <summary>
        /// 保存实体
        /// </summary>
        public static bool Save(Entity.SiteManager entity, Security.Passport passport)
        {
            if (!dal.Exists(entity.UserID,entity.SiteCode, passport))
            {
                return dal.Add(entity, passport);
            }
            return true;
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public static bool Delete(int userID,string areaCode, Security.Passport passport)
        {
            return dal.Delete(userID, areaCode,passport);
        }



        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public static Entity.SiteManager GetEntity(int userID, Security.Passport passport)
        {
            return dal.GetEntity(userID, passport);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public static DataSet GetList(string strWhere, Security.Passport passport)
        {
            return dal.GetList(strWhere, passport);
        }

        #endregion  成员方法

        #region 扩展
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public static DataTable GetManagerByAreaCode(string areaCode, Security.Passport passport)
        {
            return dal.GetManagerByAreaCode(areaCode, passport);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public static DataTable GetAreaByManager(int userID, Security.Passport passport)
        {
            return dal.GetAreaByManager(userID, passport);
        }
        #endregion
    }
}
